{{ BEGIN License }}
<p>
    HerbalWorkshop. Web database of herbals and oils, recipes and their effects.
    Copyright (C) 2009  Nikolay Gniteev godhart@gmail.com
</p>
<p>
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
</p>
<p>
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
</p>
<p>
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <a href="http://www.gnu.org/licenses/"></a>.
</p>    
{{ END License }}

{{ BEGIN table }}
	{{if($no_newline,'','<br>')}}
	<table {{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
	{{ BEGIN rows }}
		<tr {{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
		{{ BEGIN cells }}
			<td {{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
			{{ $content }}
			</td>
		{{ END cells }}
		</tr>
	{{ END rows }}
	</table>
{{ END table }}

{{ BEGIN form }}
	<form name="{{$name}}" method="{{if($get,'get','post')}}" action="{{$action}}" 
	enctype="{{if($enctype,$enctype,'multipart/form-data')}}"
	{{if($id,"id=\"$id\"")}}	
	{{print_properties($properties)}}>
	{{ if($buttons_first, $buttons, $fields) }}
	{{ if($no_split, '', '<br>') }}
	{{ if($buttons_first, $fields, $buttons) }}
	</form>
{{ END form }}

{{ BEGIN code_section }}
<SCRIPT language="{{if($lang,$lang,'JavaScript')}}">
	{{ $body }}
</SCRIPT>
{{ END code_section }}

{{ BEGIN echo }}
	{{if($no_newline,'','<br>')}}
	{{ $value }}
{{ END echo }}

{{ BEGIN paragraph }}
	<p {{if($id,"id=\"$id\"")}} print_properties($properties)>
	{{$value}}</p>
{{ END paragraph }}

{{ BEGIN comments }}
	{{if($no_newline,'','<br>')}}
	<small {{if($id,"id=\"$id\"")}} print_properties($properties)>
	{{ $value }}</small>
{{ END comments }}

{{ BEGIN submit }}
    <BUTTON name="{{if($name,$name,'submit')}}" 
    			value="{{if($value,$value,'submit')}}" 
    			type="submit"
    			{{if($id,"id=\"$id\"")}}
    			{{print_properties($properties)}}>
    <IMG src="{{$image}}" alt="{{if($label,$label,'Submit')}}">
    </BUTTON>
{{ END submit }}

{{ BEGIN reset }}
    <BUTTON name="{{if($name,$name,'reset')}}" 
    			value="{{if($value,$value,'reset')}}" 
    			type="submit"
    			{{if($id,"id=\"$id\"")}}
    			{{print_properties($properties)}}>
    <IMG src="{{$image}}" alt="{{if($label,$label,'Reset')}}">
    </BUTTON>
{{ END reset }}

{{ BEGIN button }}
    <BUTTON name="{{$name}}" 
    			value="{{$value}}" 
    			type="button"
    			onclick="{{$action}}"
    			{{if($id,"id=\"$id\"")}}
    			{{print_properties($properties)}}>
    <IMG src="{{$image}}" alt="{{$label}}">
    </BUTTON>
{{ END button }}

{{ BEGIN entry_hidden }}
	<input type="hidden" name="{{$name}}" value="{{$value}}" 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
{{ END entry_hidden }}

{{ BEGIN entry_field_text }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<input type="text" name="{{$name}}" value="{{$value}}" 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>	
{{ END entry_field_text }}

{{ BEGIN entry_free_text }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<br><textarea name="{{$name}}" 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
	{{$value}}</textarea>	
{{ END entry_text }}

{{ BEGIN entry_password }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<input type="password" name="{{$name}}" value="{{$value}}" 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
{{ END entry_password }}

{{ BEGIN entry_date }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<input type="text" name="{{$name}}" value="{{$value}}" 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
	<small>TODO:date entry control</small>
{{ END entry_date }}

{{ BEGIN entry_time }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<input type="text" name="{{$name}}" value="{{$value}}" 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
	<small>TODO:time entry control</small>
{{ END entry_time }}

{{ BEGIN entry_value }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<input type="text" name="{{$name}}" value="{{$value}}" 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>
	<small>TODO:value check</small>
{{ END entry_time }}

{{ BEGIN entry_checkbox }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<input type="checkbox" name="{{$name}}" value="{{$value}}"  {{if($checked,'checked')}} 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>	
{{ END entry_checkbox }}

{{ BEGIN entry_radio }}
	{{if($no_newline,'','<br>')}}
	{{if($no_box,$label,"<FIELDSET><LEGEND>$label</LEGEND>")}}		
	{{ BEGIN options }}
		{{if($no_newline,'','<br>')}}
		<LABEL for="{{$name}}">{{$label}}</LABEL>
		<input type="radio" name="{{$name}}" value="{{$value}}" {{if($checked,'checked')}}
		{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}">
	{{ END options }}
	{{if($no_box,'','</FIELDSET>')}}
{{ END entry_radio }}

{{ BEGIN entry_file }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<input type="file" name="{{$name}}" value="{{$value}}" 
	{{if($id,"id=\"$id\"")}} {{print_properties($properties)}}>	
{{ END entry_field_text }}

{{ BEGIN entry_combo }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
 <SELECT name="{{$name}}" {{if($multiple,'multiple="true"')}} 
 {{if($id,"id=\"$id\"")}} {{print_properties($properties)}}">
 	  {{ BEGIN options }}
     <OPTION {{if($selected,'selected','')}} label="{{$name}}" 
     			 value="{{$value}}">{{$name}}</OPTION>
     {{ END options }}
     {{ BEGIN groups }}
     <OPTGROUP label="{{$name}}">
     	 {{ BEGIN options }}
       <OPTION {{if($selected,'selected','')}} label="{{$name}}"
       			value="{{$value}}">{{$name}}</OPTION>
       {{ END options }}
     </OPTGROUP>
     {{ END groups }}
 </SELECT>
{{ END entry_combo }}

{{ BEGIN entry_aggregating_combo }}
	{{if($no_newline,'','<br>')}}
	<LABEL for="{{$name}}">{{$label}}</LABEL>
	<input type="text" id="agc_field_{{$id}}" name="{{$name}}" value="{{$value}}" {{print_properties($field_properties)}}>	
	
 <SELECT name="{{$name}}_combo" id="agc_combo_{{$id}}" {{print_properties($combo_properties)}}">
 	  {{ BEGIN options }}
     <OPTION {{if($selected,'selected','')}} label="{{$name}}" 
	     		 value="{{$value}}">{{$name}}</OPTION>
     {{ END options }}
     {{ BEGIN groups }}
     <OPTGROUP label="{{$name}}">
     	 {{ BEGIN otions }}
       <OPTION {{if($selected,'selected','')}} label="{{$name}}"
       			value="{{$value}}">{{$name}}</OPTION>
       {{ END options }}
     </OPTGROUP>
     {{ END groups }}
 </SELECT>
 
 <BUTTON name="{{$name}}_add" value="{{$name}}_add_pushed" type="button" 
			id="agc_button_{{$id}}"     		
     		onclick="agc_{{$name}}_add();" {{print_properties($button_properties)}}>
 	<IMG src="{{$image}}" alt="+">
 </BUTTON>
 <script>
 	function agc_{{$name}}_add()
 	{
 		var field = document.getElementById('agc_field_{{$id}}');
 		var combo = document.getElementById('agc_combo_{{$id}}');
 		field.value = field.value + "{{$delimter}}" + combo.options[combo.selectedIndex].text; 
 	}
 </script> 
{{ END entry_aggregating_combo }}